home *** CD-ROM | disk | FTP | other *** search
- Path: huxley.mv.us.adobe.com!user
- From: pchang@adobe.com (The Weasel)
- Newsgroups: comp.sys.mac.programmer.codewarrior,comp.lang.c++
- Subject: Re: using a template parameter as a qualifier -- legal or not?
- Date: Fri, 09 Feb 1996 09:43:13 -0800
- Organization: Adobe Systems
- Message-ID: <pchang-0902960943130001@huxley.mv.us.adobe.com>
- References: <rshapiro-0602961258310001@esb.bbn.com> <3117C2B0.41C6@tiger.physics.utoronto.ca>
- NNTP-Posting-Host: huxley.mv.us.adobe.com
-
- > R Shapiro wrote:
- > >
- > > I'd like to use the formal argument to a template as the qualifier of a
- > > qualified typename within the template. This doesn't work in CodeWarrior
- > > 8, it does work in VC++ 4.0, and I can't tell from ARM whether or not it
- > > *should* work.
- > >
- > > Here's a more specific example:
- > >
- > > template <class OBJECT>
- > > class OrderedCollection {
- > > typedef void (OBJECT::*memberMapper)(void);
- > > .
- > > .
- > > .
- > > };
- > >
- > > I would like the typedef 'memberMapper' to refer to pointers to member
- > > functions (of no arguments and returning no value) of whatever class is
- > > specified in a given instantiation of the template.
-
- I found this in the sep 95 working paper. This is in section 14.2 Template
- name resolution.
-
- 2 In a template, any use of a qualified-name where the qualifier depends
- on a template-parameter can be prefixed by the keyword typename to
- indicate that the qualified-name denotes a type.
- elaborated-type-specifier:
-
- typename ::opt nested-name-specifier identifier
- full-template-argument-listopt
-
- 3 If a specialization of that template is generated for a template-
- argument such that the qualified-name does not denote a type, the speĀ”
- cialization is ill-formed. The keyword typename states that the folĀ”
- lowing qualified-name names a type. [Note: but gives no clue to what
- that type might be. ] The qualified-name shall include a qualifier
- containing a template parameter or a template class name.
-
- I have not yet tried it out w/ cw8, but the draft standard has anticipated
- your usage. I hope this helps.
-
- \p
- --
- ObDisclaimer: #include <Disclaimer.h>
- ObQuote: Chi non ha paura di morire muore una volta sola.
- - Giovanni Falcone
-